<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>login</title>

</head>
<body>

   <center>

       <h1>个人网上银行</h1>
       <form method="post" action="javascript:;" onsubmit="return aa();">

           卡号<input name="cardNo"><br/>
           密码<input type="password" name="password"> <br/>
           验证码:<input name="code"><br/>
           <img src="/code"/>

           <input type="submit" value="登录网上银行">
       </form>
   </center>


   <script src="/jquery3.3.1.js"></script>
    <script>
        $("img").click(function () {
            $(this).attr("src","/code?aaa="+new Date().getTime());
        })
        function aa(){
            var cardNo = $("[name=cardNo]").val();
            var password = $("[name=password]").val();
            var code = $("[name=code]").val();

            if (cardNo==''||password==''||code==''){
                alert('请填写完整信息');
                return false;
            }
            $.post("/info/login?cardNo="+cardNo+"&password="+password+"&code="+code,function (data) {
                if (data!='成功'){
                    alert(data);
                } else {
                    alert(data);
                    location.href='/info/towelcome';
                }
            })
            return true;
        }

    </script>
</body>
</html>